3.10.19 \(\int \frac {(c-i c \tan (e+f x))^4}{a+i a \tan (e+f x)} \, dx\) [919]

Optimal. Leaf size=95 \[ -\frac {12 c^4 x}{a}-\frac {12 i c^4 \log (\cos (e+f x))}{a f}+\frac {5 c^4 \tan (e+f x)}{a f}-\frac {i c^4 \tan ^2(e+f x)}{2 a f}+\frac {8 i c^4}{f (a+i a \tan (e+f x))} \]

[Out]

-12*c^4*x/a-12*I*c^4*ln(cos(f*x+e))/a/f+5*c^4*tan(f*x+e)/a/f-1/2*I*c^4*tan(f*x+e)^2/a/f+8*I*c^4/f/(a+I*a*tan(f
*x+e))

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 95, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45} \begin {gather*} -\frac {i c^4 \tan ^2(e+f x)}{2 a f}+\frac {5 c^4 \tan (e+f x)}{a f}+\frac {8 i c^4}{f (a+i a \tan (e+f x))}-\frac {12 i c^4 \log (\cos (e+f x))}{a f}-\frac {12 c^4 x}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c - I*c*Tan[e + f*x])^4/(a + I*a*Tan[e + f*x]),x]

[Out]

(-12*c^4*x)/a - ((12*I)*c^4*Log[Cos[e + f*x]])/(a*f) + (5*c^4*Tan[e + f*x])/(a*f) - ((I/2)*c^4*Tan[e + f*x]^2)
/(a*f) + ((8*I)*c^4)/(f*(a + I*a*Tan[e + f*x]))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 3603

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rubi steps

\begin {align*} \int \frac {(c-i c \tan (e+f x))^4}{a+i a \tan (e+f x)} \, dx &=\left (a^4 c^4\right ) \int \frac {\sec ^8(e+f x)}{(a+i a \tan (e+f x))^5} \, dx\\ &=-\frac {\left (i c^4\right ) \text {Subst}\left (\int \frac {(a-x)^3}{(a+x)^2} \, dx,x,i a \tan (e+f x)\right )}{a^3 f}\\ &=-\frac {\left (i c^4\right ) \text {Subst}\left (\int \left (5 a-x+\frac {8 a^3}{(a+x)^2}-\frac {12 a^2}{a+x}\right ) \, dx,x,i a \tan (e+f x)\right )}{a^3 f}\\ &=-\frac {12 c^4 x}{a}-\frac {12 i c^4 \log (\cos (e+f x))}{a f}+\frac {5 c^4 \tan (e+f x)}{a f}-\frac {i c^4 \tan ^2(e+f x)}{2 a f}+\frac {8 i c^4}{f (a+i a \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(194\) vs. \(2(95)=190\).
time = 2.08, size = 194, normalized size = 2.04 \begin {gather*} \frac {c^4 \cos (e) \sec (e+f x) (\cos (f x)+i \sin (f x)) \left (-24 f x-12 i \log \left (\cos ^2(e+f x)\right )+24 f x \sec ^2(e)-i \sec ^2(e+f x)+10 \sec (e) \sec (e+f x) \sin (f x)+8 \sin (2 f x)+12 \log \left (\cos ^2(e+f x)\right ) \tan (e)+\sec ^2(e+f x) \tan (e)+10 i \sec (e) \sec (e+f x) \sin (f x) \tan (e)-8 i \sin (2 f x) \tan (e)-24 f x \tan ^2(e)-24 i \text {ArcTan}(\tan (f x)) (-i+\tan (e))+8 \cos (2 f x) (i+\tan (e))\right )}{2 f (a+i a \tan (e+f x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c - I*c*Tan[e + f*x])^4/(a + I*a*Tan[e + f*x]),x]

[Out]

(c^4*Cos[e]*Sec[e + f*x]*(Cos[f*x] + I*Sin[f*x])*(-24*f*x - (12*I)*Log[Cos[e + f*x]^2] + 24*f*x*Sec[e]^2 - I*S
ec[e + f*x]^2 + 10*Sec[e]*Sec[e + f*x]*Sin[f*x] + 8*Sin[2*f*x] + 12*Log[Cos[e + f*x]^2]*Tan[e] + Sec[e + f*x]^
2*Tan[e] + (10*I)*Sec[e]*Sec[e + f*x]*Sin[f*x]*Tan[e] - (8*I)*Sin[2*f*x]*Tan[e] - 24*f*x*Tan[e]^2 - (24*I)*Arc
Tan[Tan[f*x]]*(-I + Tan[e]) + 8*Cos[2*f*x]*(I + Tan[e])))/(2*f*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Maple [A]
time = 0.16, size = 57, normalized size = 0.60

method result size
derivativedivides \(\frac {c^{4} \left (5 \tan \left (f x +e \right )-\frac {i \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {8}{\tan \left (f x +e \right )-i}+12 i \ln \left (\tan \left (f x +e \right )-i\right )\right )}{f a}\) \(57\)
default \(\frac {c^{4} \left (5 \tan \left (f x +e \right )-\frac {i \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {8}{\tan \left (f x +e \right )-i}+12 i \ln \left (\tan \left (f x +e \right )-i\right )\right )}{f a}\) \(57\)
risch \(\frac {4 i c^{4} {\mathrm e}^{-2 i \left (f x +e \right )}}{a f}-\frac {24 c^{4} x}{a}-\frac {24 c^{4} e}{a f}+\frac {2 i c^{4} \left (4 \,{\mathrm e}^{2 i \left (f x +e \right )}+5\right )}{f a \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {12 i c^{4} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a f}\) \(106\)
norman \(\frac {\frac {17 i c^{4}}{2 a f}-\frac {12 c^{4} x}{a}+\frac {5 c^{4} \left (\tan ^{3}\left (f x +e \right )\right )}{a f}-\frac {12 c^{4} x \left (\tan ^{2}\left (f x +e \right )\right )}{a}+\frac {13 c^{4} \tan \left (f x +e \right )}{a f}-\frac {i c^{4} \left (\tan ^{4}\left (f x +e \right )\right )}{2 a f}}{1+\tan ^{2}\left (f x +e \right )}+\frac {6 i c^{4} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{a f}\) \(133\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c-I*c*tan(f*x+e))^4/(a+I*a*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*c^4/a*(5*tan(f*x+e)-1/2*I*tan(f*x+e)^2+8/(tan(f*x+e)-I)+12*I*ln(tan(f*x+e)-I))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^4/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 179 vs. \(2 (89) = 178\).
time = 1.01, size = 179, normalized size = 1.88 \begin {gather*} -\frac {2 \, {\left (12 \, c^{4} f x e^{\left (6 i \, f x + 6 i \, e\right )} - 2 i \, c^{4} + 6 \, {\left (4 \, c^{4} f x - i \, c^{4}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (4 \, c^{4} f x - 3 i \, c^{4}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 \, {\left (i \, c^{4} e^{\left (6 i \, f x + 6 i \, e\right )} + 2 i \, c^{4} e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{4} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{a f e^{\left (6 i \, f x + 6 i \, e\right )} + 2 \, a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^4/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

-2*(12*c^4*f*x*e^(6*I*f*x + 6*I*e) - 2*I*c^4 + 6*(4*c^4*f*x - I*c^4)*e^(4*I*f*x + 4*I*e) + 3*(4*c^4*f*x - 3*I*
c^4)*e^(2*I*f*x + 2*I*e) + 6*(I*c^4*e^(6*I*f*x + 6*I*e) + 2*I*c^4*e^(4*I*f*x + 4*I*e) + I*c^4*e^(2*I*f*x + 2*I
*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(a*f*e^(6*I*f*x + 6*I*e) + 2*a*f*e^(4*I*f*x + 4*I*e) + a*f*e^(2*I*f*x + 2*I
*e))

________________________________________________________________________________________

Sympy [A]
time = 0.28, size = 175, normalized size = 1.84 \begin {gather*} \frac {8 i c^{4} e^{2 i e} e^{2 i f x} + 10 i c^{4}}{a f e^{4 i e} e^{4 i f x} + 2 a f e^{2 i e} e^{2 i f x} + a f} + \begin {cases} \frac {4 i c^{4} e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (\frac {24 c^{4}}{a} + \frac {\left (- 24 c^{4} e^{2 i e} + 8 c^{4}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {24 c^{4} x}{a} - \frac {12 i c^{4} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))**4/(a+I*a*tan(f*x+e)),x)

[Out]

(8*I*c**4*exp(2*I*e)*exp(2*I*f*x) + 10*I*c**4)/(a*f*exp(4*I*e)*exp(4*I*f*x) + 2*a*f*exp(2*I*e)*exp(2*I*f*x) +
a*f) + Piecewise((4*I*c**4*exp(-2*I*e)*exp(-2*I*f*x)/(a*f), Ne(a*f*exp(2*I*e), 0)), (x*(24*c**4/a + (-24*c**4*
exp(2*I*e) + 8*c**4)*exp(-2*I*e)/a), True)) - 24*c**4*x/a - 12*I*c**4*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 200 vs. \(2 (89) = 178\).
time = 0.66, size = 200, normalized size = 2.11 \begin {gather*} \frac {2 \, {\left (-\frac {6 i \, c^{4} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a} + \frac {12 i \, c^{4} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a} - \frac {6 i \, c^{4} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a} - \frac {13 \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 9 i \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 24 \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 9 i \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 13 \, c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - i \, \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{2} a}\right )}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^4/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

2*(-6*I*c^4*log(tan(1/2*f*x + 1/2*e) + 1)/a + 12*I*c^4*log(tan(1/2*f*x + 1/2*e) - I)/a - 6*I*c^4*log(tan(1/2*f
*x + 1/2*e) - 1)/a - (13*c^4*tan(1/2*f*x + 1/2*e)^5 - 9*I*c^4*tan(1/2*f*x + 1/2*e)^4 - 24*c^4*tan(1/2*f*x + 1/
2*e)^3 + 9*I*c^4*tan(1/2*f*x + 1/2*e)^2 + 13*c^4*tan(1/2*f*x + 1/2*e))/((tan(1/2*f*x + 1/2*e)^3 - I*tan(1/2*f*
x + 1/2*e)^2 - tan(1/2*f*x + 1/2*e) + I)^2*a))/f

________________________________________________________________________________________

Mupad [B]
time = 4.68, size = 85, normalized size = 0.89 \begin {gather*} \frac {5\,c^4\,\mathrm {tan}\left (e+f\,x\right )}{a\,f}+\frac {c^4\,8{}\mathrm {i}}{a\,f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}-\frac {c^4\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}}{2\,a\,f}+\frac {c^4\,\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,12{}\mathrm {i}}{a\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c - c*tan(e + f*x)*1i)^4/(a + a*tan(e + f*x)*1i),x)

[Out]

(5*c^4*tan(e + f*x))/(a*f) + (c^4*8i)/(a*f*(tan(e + f*x)*1i + 1)) - (c^4*tan(e + f*x)^2*1i)/(2*a*f) + (c^4*log
(tan(e + f*x) - 1i)*12i)/(a*f)

________________________________________________________________________________________